]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st/viewport: Keep painting, clipping and transforms pixel-aligned
authorDaniel van Vugt <daniel.van.vugt@canonical.com>
Mon, 17 Jul 2023 09:01:42 +0000 (17:01 +0800)
committerMarge Bot <marge-bot@gnome.org>
Sun, 20 Aug 2023 01:10:44 +0000 (01:10 +0000)
Which means adjustments always converted to ints in the same way.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6835
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2828>

src/st/st-viewport.c

index ad888fd9103c9aeda2a9551aee82a2739cdb08e6..e6b912766b7e10ae2787c4b429e7139741b9a68c 100644 (file)
@@ -370,10 +370,10 @@ st_viewport_apply_transform (ClutterActor      *actor,
   graphene_point3d_t p = GRAPHENE_POINT3D_INIT_ZERO;
 
   if (priv->hadjustment)
-    p.x = -get_hadjustment_value (viewport);
+    p.x = -(int)get_hadjustment_value (viewport);
 
   if (priv->vadjustment)
-    p.y = -st_adjustment_get_value (priv->vadjustment);
+    p.y = -(int)st_adjustment_get_value (priv->vadjustment);
 
   graphene_matrix_translate (matrix, &p);
 
@@ -384,8 +384,8 @@ st_viewport_apply_transform (ClutterActor      *actor,
  * up or the background and borders will be drawn in the wrong place */
 static void
 get_border_paint_offsets (StViewport *viewport,
-                          double     *x,
-                          double     *y)
+                          int        *x,
+                          int        *y)
 {
   StViewportPrivate *priv = st_viewport_get_instance_private (viewport);
 
@@ -408,7 +408,7 @@ st_viewport_paint (ClutterActor        *actor,
   StViewport *viewport = ST_VIEWPORT (actor);
   StViewportPrivate *priv = st_viewport_get_instance_private (viewport);
   StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor));
-  double x, y;
+  int x, y;
   ClutterActorBox allocation_box;
   ClutterActorBox content_box;
   ClutterActor *child;
@@ -418,7 +418,7 @@ st_viewport_paint (ClutterActor        *actor,
   if (x != 0 || y != 0)
     {
       cogl_framebuffer_push_matrix (fb);
-      cogl_framebuffer_translate (fb, (int)x, (int)y, 0);
+      cogl_framebuffer_translate (fb, x, y, 0);
     }
 
   st_widget_paint_background (ST_WIDGET (actor), paint_context);
@@ -465,7 +465,7 @@ st_viewport_pick (ClutterActor       *actor,
   StViewport *viewport = ST_VIEWPORT (actor);
   StViewportPrivate *priv = st_viewport_get_instance_private (viewport);
   StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor));
-  double x, y;
+  int x, y;
   g_autoptr (ClutterActorBox) allocation_box = NULL;
   ClutterActorBox content_box;
   ClutterActor *child;
@@ -506,7 +506,7 @@ st_viewport_get_paint_volume (ClutterActor       *actor,
   StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor));
   ClutterActorBox allocation_box;
   ClutterActorBox content_box;
-  double x, y;
+  int x, y;
 
   /* Setting the paint volume does not make sense when we don't have any allocation */
   if (!clutter_actor_has_allocation (actor))